package com.zhihuichongcheng.application.ui.coordination.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.smartlib.cmnObject.util.GsonUtil;
import com.zhihuichongcheng.application.R;
import com.zhihuichongcheng.application.base.BaseActivity;
import com.zhihuichongcheng.application.im.db.FileBean;
import com.zhihuichongcheng.application.ui.coordination.adapter.DownLoadAdater;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 3water on 2016/11/8.
 */

public class DownLoadManagerActivity extends BaseActivity  {
    private RecyclerView mRcvDownLoad;
    private List<FileBean> fileBeens = new ArrayList<>();
    private DownLoadAdater mAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_download_manager);
        initView();
        initData();
    }

    private void initView()
    {
        setTitle("下载列表");
        mRcvDownLoad = (RecyclerView)findViewById(R.id.rcv_download);
        mRcvDownLoad.setLayoutManager(new LinearLayoutManager(mContext));
        mAdapter = new DownLoadAdater(mContext);
        mRcvDownLoad.setAdapter(mAdapter);
    }

    private void initData()
    {
        String value = spUtil.getString("downlaod");
        fileBeens = GsonUtil.paraeFromStringToList(value,FileBean.class);
        mAdapter.setData(fileBeens);
        mAdapter.notifyDataSetChanged();
    }


}
